//
//  HNNewsTitleCollectionCell.m
//  hnGovernment
//
//  Created by 安仔 on 2017/3/14.
//  Copyright © 2017年 安仔. All rights reserved.
//

#import "HNNewsTitleCollectionCell.h"

@implementation HNNewsTitleCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.titleLabel];
        [self addSubview:self.comeFromLabel];
        [self addSubview:self.timeLabel];
    }
    return self;
}

- (void) layoutSubviews {

    [super layoutSubviews];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_left).offset(5*m6Scale);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-5*m6Scale);
        make.top.mas_equalTo(self.contentView.mas_top).offset(10*m6Scale);
    }];
    
    [self.comeFromLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.titleLabel.mas_left);
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20*m6Scale);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.comeFromLabel.mas_right).offset(40*m6Scale);
        make.centerY.mas_equalTo(self.comeFromLabel.mas_centerY);
    }];

}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.text = NSLocalString(@"2017-02-28");
        _timeLabel.textColor = [UIColor lightGrayColor];
        _timeLabel.font = [UIFont systemFontOfSize:20*m6Scale];
    }
    return _timeLabel;
}

- (UILabel *)comeFromLabel {
    if (!_comeFromLabel) {
        _comeFromLabel = [[UILabel alloc] init];
        _comeFromLabel.text = NSLocalString(@"来源：河南新闻");
        _comeFromLabel.textColor = [UIColor lightGrayColor];
        _comeFromLabel.font = [UIFont systemFontOfSize:20*m6Scale];
    }
    return _comeFromLabel;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.text = NSLocalString(@"行政许可事项减少到516项，事发看道林是都烦死了瑟吉欧几番四");
        _titleLabel.textColor = TitleColor;
        _titleLabel.font = [UIFont systemFontOfSize:28*m6Scale];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

@end
